package com.yexiong.server.process;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.common.entity.DataPack;
import com.common.entity.ExamDetail;
import com.common.server.view.ServerMainFrame;
import com.common.server.view.ServerProcessThread;
import com.common.server.view.ServiceProcess;

import com.yexiong.server.dao.IExamDetailServer;
import com.yexiong.server.dao.impl.ExamDetailServerImpl;

public class ExamDetailServiceProcess implements ServiceProcess{

	@Override
	public Object service(DataPack dataPack, ServerProcessThread serverProcessThread, ServerMainFrame serverMainFrame)
			throws IOException {
			 IExamDetailServer iExamDetailServer= new  ExamDetailServerImpl();
		if(dataPack.getOptType().equals("getAllSub")) {
			List<ExamDetail> examDetails = new  ArrayList<>();
			
			examDetails = iExamDetailServer.getExam((int) dataPack.getCon());
			
			DataPack p1 = new DataPack();
			p1.setCon(examDetails);
			p1.setOptType(dataPack.getOptType());
			serverProcessThread.getOos().writeObject(p1);
			serverProcessThread.getOos().flush();
		
		}
		return null;
	}

}
